#pragma once

#include "Recorder.h"
#include <list>


class SoundPlayer : public exl::ps::ThreadBase, public SoundBufferConsumer
{
	static const int sampleRate = 16000;

	std::list <SoundBuffer *> buffers;
	HWAVEOUT hWaveOut;
	int timeOfEachBuffer;
	int numOfBuffersOnInit;	// quantidade de buffers que devem estar na fila antes de iniciar reproducao

public:
	SoundPlayer(int timeOfEachBuffer = 500, int numOfBuffersOnInit = 4)
		:	hWaveOut(NULL),
			timeOfEachBuffer(timeOfEachBuffer), numOfBuffersOnInit(numOfBuffersOnInit)
	{
	}

	void appendBuffer(SoundBuffer & sb);

	int run();
};
